package com.yanboo.generator.domain;

import com.yanboo.common.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * 代码生成配置
 */
@Getter
@Setter
@Entity
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@Table(name = "code_gen_config")
public class GenConfig extends BaseEntity implements Serializable {

    public GenConfig(String tableName) {
        this.tableName = tableName;
    }

//    @ManyToOne(fetch =FetchType.EAGER)
//    @JoinColumn(name = "project_code",referencedColumnName = "code",foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
//    private ProjectInfo projectInfo;
    @Schema(description = "项目编码")
    private String projectCode;

    @NotBlank
    @Schema(description = "表名")
    private String tableName;

    @Schema(description = "接口名称")
    private String apiAlias;

    @NotBlank
    @Schema(description = "包路径")
    private String pack;

    @NotBlank
    @Schema(description = "模块名")
    private String moduleName;

    @NotBlank
    @Schema(description = "前端文件路径")
    private String path;

    @Schema(description = "前端文件路径")
    private String apiPath;

    @Schema(description = "作者")
    private String author;

    @Schema(description = "表前缀")
    private String prefix;

    @Schema(description = "是否覆盖")
    private Boolean cover = false;
}
